/// 
/// Author: Jeff Liu
/// Date: 2023-04-25 01:14:52
/// LastEditTime: 2023-05-15 17:07:32
/// LastEditors: Jeff Liu
/// Description: 
/// FilePath: /HCCBJ/src/HCC/Interface/PubSub/spec.cls
/// Jeff.liu@intersytems.com
/// 
Class HCC.Interface.PubSub.spec Extends %REST.Spec [ ProcedureBlock ]
{

Parameter HandleCorsRequest = 1;

XData OpenAPI [ MimeType = application/json ]
{
{
  "swagger":"2.0",
  "info":{
    "title":"PUBSUB API",
    "version":"3.0"
  },
  "securityDefinitions":{
    "basicAuth":{
      "type":"basic"
    }
  },
  "security":[
    {
      "basicAuth":[
      ]
    }
  ],
  "basePath":"/hcc/pubsub",
  "schemes":[
    "http",
    "https"
  ],
  "paths":{
    "/newtopic":{
      "post":{
        "tags":[
          "可订阅主题管理接口"
        ],
        "summary":"增加新主题",
        "description":"新增主题",
        "operationId":"newtopic",
        "produces":[
          "application/json"
        ],
        "parameters":[
          {
            "in":"body",
            "name":"body",
            "description":"newtopic",
            "required":true,
            "schema":{
              "$ref":"#/definitions/newtopic"
            }
          }
        ],
        "responses":{
          "201":{
            "description":"successful operation",
            "schema":{
              "$ref":"#/definitions/newtopicaddedresponse"
            }
          },
          "409":{
            "description":"主题名称已经存在",
            "schema":{
              "$ref":"#/definitions/topicaldreadyexist"
            }
          }
        }
      }
    },
    "/gettopic":{
      "get":{
        "tags":[
          "可订阅主题管理接口"
        ],
        "summary":"获取可订阅主题",
        "description":"get topic",
        "operationId":"gettopic",
        "produces":[
          "application/json"
        ],
        "parameters":[
          {
            "name":"Topic",
            "in":"query",
            "description":"get topic",
            "required":false,
            "type":"string"
          }
        ],
        "responses":{
          "200":{
            "description":"successful operation",
            "schema":{
              "$ref":"#/definitions/gettopic"
            }
          }
        }
      }
    },
    "/removetopic/{topicname}":{
      "delete":{
        "tags":[
          "可订阅主题管理接口"
        ],
        "summary":"删除主题",
        "description":"按照id删除主题",
        "operationId":"removetopic",
        "produces":[
          "application/json"
        ],
        "parameters":[
          {
            "name":"topicname",
            "in":"path",
            "description":"removetopic",
            "required":true,
            "type":"string"
          }
        ],
        "responses":{
          "200":{
            "description":"successful operation",
            "schema":{
              "$ref":"#/definitions/removetopic"
            }
          }
        }
      }
    },
    "/newsubscriber":{
      "post":{
        "tags":[
          "订阅者管理接口"
        ],
        "summary":"增加新订阅者",
        "description":"新增订阅者",
        "operationId":"newsubscriber",
        "produces":[
          "application/json"
        ],
        "parameters":[
          {
            "in":"body",
            "name":"body",
            "description":"newsubscriber",
            "required":true,
            "schema":{
              "$ref":"#/definitions/newsubscriber"
            }
          }
        ],
        "responses":{
          "201":{
            "description":"successful operation",
            "schema":{
              "$ref":"#/definitions/newsubscriberaddedresponse"
            }
          }
        }
      }
    },
    "/getsubscriber":{
      "get":{
        "tags":[
          "订阅者管理接口"
        ],
        "summary":"获取订阅者",
        "description":"获取订阅者",
        "operationId":"getsubscriber",
        "produces":[
          "application/json"
        ],
        "parameters":[
          {
            "name":"ID",
            "in":"query",
            "description":"get subscriber using ID",
            "required":false,
            "type":"string"
          },
          {
            "name":"SubscriberName",
            "in":"query",
            "description":"get subscriber using name",
            "required":false,
            "type":"string"
          }
        ],
        "responses":{
          "200":{
            "description":"successful operation",
            "schema":{
              "$ref":"#/definitions/getsubscriber"
            }
          }
        }
      }
    },
    "/removesubscriber/{id}":{
      "delete":{
        "tags":[
          "订阅者管理接口"
        ],
        "summary":"删除订阅者",
        "description":"按照id删除订阅者",
        "operationId":"removesubscriber",
        "produces":[
          "application/json"
        ],
        "parameters":[
          {
            "name":"id",
            "in":"path",
            "description":"removesubscriber",
            "required":true,
            "type":"integer"
          }
        ],
        "responses":{
          "200":{
            "description":"successful operation",
            "schema":{
              "$ref":"#/definitions/removesubscriber"
            }
          }
        }
      }
    },
    "/newsubscription":{
      "post":{
        "tags":[
          "订阅关系管理接口"
        ],
        "summary":"新增订阅",
        "description":"新增订阅",
        "operationId":"newsubscription",
        "produces":[
          "application/json"
        ],
        "parameters":[
          {
            "in":"body",
            "name":"body",
            "description":"newsubscription",
            "required":true,
            "schema":{
              "$ref":"#/definitions/newsubscription"
            }
          }
        ],
        "responses":{
          "201":{
            "description":"successful operation",
            "schema":{
              "$ref":"#/definitions/newsubscriptionaddedresponse"
            }
          }
        }
      }
    },
    "/getsubscription":{
      "get":{
        "tags":[
          "订阅关系管理接口"
        ],
        "summary":"获取订阅",
        "description":"获取订阅",
        "operationId":"getsubscription",
        "produces":[
          "application/json"
        ],
        "parameters":[
          {
            "name":"SubscriptionID",
            "in":"query",
            "description":"get subscribers using ID",
            "required":false,
            "type":"string"
          }
        ],
        "responses":{
          "200":{
            "description":"successful operation",
            "schema":{
              "$ref":"#/definitions/getsubscription"
            }
          }
        }
      }
    },
    "/removesubscription/{id}":{
      "delete":{
        "tags":[
          "订阅关系管理接口"
        ],
        "summary":"删除订阅",
        "description":"删除订阅",
        "operationId":"removesubscription",
        "produces":[
          "application/json"
        ],
        "parameters":[
          {
            "name":"id",
            "in":"path",
            "description":"removesubscription",
            "required":true,
            "type":"integer"
          }
        ],
        "responses":{
          "200":{
            "description":"successful operation",
            "schema":{
              "$ref":"#/definitions/removesubscription"
            }
          }
        }
      }
    }
  },
  "definitions":{
    "newtopic":{
      "type":"object",
      "required":[
        "TopicName",
        "SchemaType"
      ],
      "properties":{
        "TopicName":{
          "type":"string",
          "example":"BloodTransAppInfoAdd"
        },
        "SchemaType":{
          "type":"string",
          "example":"POOR_IN200901UV"
        }
      }
    },
    "newtopicaddedresponse":{
      "type":"object",
      "properties":{
        "TopicName":{
          "type":"string",
          "example":"BloodTransAppInfoAdd"
        },
        "Message":{
          "type":"string",
          "example":"主题已添加"
        }
      }
    },
    "topicaldreadyexist":{
      "type":"object",
      "properties":{
        "TopicName":{
          "type":"string",
          "example":"BloodTransAppInfoAdd"
        },
        "Message":{
          "type":"string",
          "example":"主题已存在,添加失败"
        }
      }
    },
    "gettopic":{
      "type":"array",
      "items":{
        "type":"object",
        "properties":{
          "TopicName":{
            "type":"string",
            "example":"BloodTransAppInfoAdd"
          },
          "SchemaType":{
            "type":"string",
            "example":"POOR_IN200901UV"
          }
        }
      }
    },
    "removetopic":{
      "type":"object",
      "properties":{
        "TopicName":{
          "type":"string",
          "example":"BloodTransAppInfoAdd"
        },
        "Message":{
          "type":"string",
          "example":"主题已删除"
        }
      }
    },
    "newsubscriber":{
      "type":"object",
      "required":[
        "SubscriberName",
        "Target",
        "TargetProduction"
      ],
      "properties":{
        "SubscriberName":{
          "type":"string",
          "example":"EMR订阅者"
        },
        "TargetAuthConfigName":{
          "type":"string",
          "example":"EMRAuth"
        },
        "Target":{
          "type":"string",
          "example":"EMR"
        },
        "TargetProduction":{
          "type":"string",
          "example":"HCC.SVR.Prod.FoundationProduction"
        },
        "TargetClass":{
          "type":"string",
          "example":"HCC.SVR.Prod.BO.StandardHCCOutBound"
        },
        "TargetURL":{
          "type":"string",
          "example":"http://192.168.76.136:52773/mocksys/EMR.WS.PatientService.cls"
        },
        "TargetSoapAction":{
          "type":"string",
          "example":"urn:hl7-org:v3/EMR.WS.PatientService.HIPMessageServer"
        },
        "Priority":{
          "type":"string",
          "enum":[
            "High",
            "Normal",
            "Low"
          ],
          "example":"Normal",
          "default":"Normal"
        },
        "PersonalContactName":{
          "type":"string",
          "example":"张三"
        },
        "PersonalContact":{
          "type":"string",
          "example":"13000000011"
        },
        "Role":{
          "type":"string",
          "example":"System",
          "default":"System",
          "enum":[
            "System",
            "Person"
          ]
        },
        "IsActive":{
          "type":"boolean",
          "default":true
        }
      }
    },
    "newsubscriberaddedresponse":{
      "type":"object",
      "properties":{
        "SubscriberName":{
          "type":"string",
          "example":"EMR订阅者"
        },
        "ID":{
          "type":"string",
          "example":"1"
        },
        "Message":{
          "type":"string",
          "example":"订阅者已添加"
        }
      }
    },
    "removesubscriber":{
      "type":"object",
      "properties":{
        "Subsciber":{
          "type":"string",
          "example":"订阅者EMR"
        },
        "Message":{
          "type":"string",
          "example":"删除成功"
        }
      }
    },
    "getsubscriber":{
      "type":"array",
      "items":{
        "type":"object",
        "properties":{
          "ID":{
            "type":"integer",
            "example":"1"
          },
          "Name":{
            "type":"string",
            "example":"订阅者EMR"
          },
          "TargetAuthConigName":{
            "type":"string",
            "example":"EMRAuth"
          },
          "TargetAuthConigUserName":{
            "type":"string",
            "example":"admin"
          },
          "TargetAuthConigPassword":{
            "type":"string",
            "format":"password",
            "example":"123456"
          },
          "Target":{
            "type":"string",
            "example":"EMR"
          },
          "TargetURL":{
            "type":"string",
            "example":"http://192.168.76.136:52773/mocksys/EMR.WS.PatientService.cls"
          },
          "SoapAction":{
            "type":"string",
            "example":"urn:hl7-org:v3/EMR.WS.PatientService.HIPMessageServer"
          },
          "Priority":{
            "type":"string",
            "enum":[
              "High",
              "Normal",
              "Low"
            ],
            "example":"Normal",
            "default":"Normal"
          },
          "PersonalContactName":{
            "type":"string",
            "example":"张三"
          },
          "PersonsalContact":{
            "type":"string",
            "example":"13000000011"
          },
          "Role":{
            "type":"string",
            "example":"System",
            "default":"System"
          },
          "IsActive":{
            "type":"boolean",
            "default":true
          },
          "CreatedAt":{
            "type":"string",
            "example":"2022-01-01:00:00:00"
          }
        }
      }
    },
    "newsubscription":{
      "type":"object",
      "required":[
        "Subscriber",
        "Topic",
        "IsSync"
      ],
      "properties":{
        "SubscriberName":{
          "type":"string",
          "example":"EMR"
        },
        "TopicName":{
          "type":"string",
          "example":"BloodTransAppInfoAdd"
        },
        "IsSync":{
          "type":"boolean",
          "example":true
        },
        "IsEnabled":{
          "type":"boolean",
          "default":true,
          "example":true
        }
      }
    },
    "newsubscriptionaddedresponse":{
      "type":"object",
      "properties":{
        "Name":{
          "type":"string",
          "example":"EMR系统__BloodTransAppInfoAdd"
        },
        "Message":{
          "type":"string",
          "example":"订阅已添加"
        }
      }
    },
    "getsubscription":{
      "type":"array",
      "items":{
        "type":"object",
        "properties":{
          "SubscriptionID":{
            "type":"integer",
            "example":"1"
          },
          "SubscriberName":{
            "type":"string",
            "example":"EMR系统"
          },
          "SubscriberID":{
            "type":"integer",
            "example":"1"
          },
          "TopicName":{
            "type":"string",
            "example":"BloodTransAppInfoAdd"
          },
          "TopicID":{
            "type":"integer",
            "example":"1"
          },
          "IsSync":{
            "type":"boolean",
            "example":true
          },
          "IsEnabled":{
            "type":"boolean",
            "example":true
          },
          "CreatedAt":{
            "type":"string",
            "example":"2020-01-01:00:00:00"
          }
        }
      }
    },
    "removesubscription":{
      "type":"object",
      "properties":{
        "Subscription":{
          "type":"string",
          "example":"EMR系统__BloodTransAppInfoAdd"
        },
        "Message":{
          "type":"string",
          "example":"订阅删除成功"
        }
      }
    }
  }
}
}

}
